package com.ctu.gzero.container
{
	import com.ctu.gzero.edit.ISelectionManager;
	import com.ctu.gzero.edit.SelectionFormat;
	import flash.ui.Mouse;
	import flash.ui.MouseCursor;
	import flash.display.DisplayObjectContainer;
	
	public class ContainerController extends BaseController implements IController
	{
		private var _width:Number;
		private var _height:Number;
		
		
		public function ContainerController(container:DisplayObjectContainer, width:Number, height:Number)
		{
			super(container);
			_width = width;
			_height = height;
			attachBackgroundShape(_width, _height);
		}
		
		public function get width():Number
		{
			return _width;
		}
		
		public function get height():Number
		{
			return _height;		
		}
		
		public function get container():DisplayObjectContainer
		{
			return _container;	
		}
		
		public function interactionManagerChanged(interactionManager:ISelectionManager):void
		{
			if(_interactionManager == null)
			{
				if(interactionManager)
				{
					_interactionManager = interactionManager;
					attachAllListener();
				}
			}
			else 
			{
				if(interactionManager == null)
				{
					Mouse.cursor = MouseCursor.AUTO;
					_interactionManager = interactionManager;
					detachAllListerner();	
				}		
			}
		}
		
		public function showCursor(x:Number, y:Number, width:Number, height:Number):void
		{
			super.drawBlinkCursor(x, y, width, height);
		}
		
		public function drawPointSelection(format:SelectionFormat, x:Number,y:Number,width:Number, height:Number):void
		{
			super.drawSelection(format, x,y,width, height);
		}
		public function hideSelectionShape():void
		{
			super.hideSelection();
		}
	}
}